Test Failed
Push — develop ( 424bfb...c8c23d )
by Endre
02:45
created

Application.onLanguageLoaded   A

Complexity

Conditions 1

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 3
c 0
b 0
f 0
rs 10
ccs 0
cts 0
cp 0
cc 1
crap 2
1
import React from 'react';
2
import {ILanguageSetup} from '../Language/ChangeLanguageSetup';
3
import Container from './Container';
4
import ApplicationModel from './Model/ApplicationModel';
5
import ApplicationView from './View/ApplicationView';
6
7
interface IProperties {
8
}
9
10
interface IState {
11
  loadedLanguage: string
12
}
13
14 1
export default class Application extends React.Component<IProperties, IState> {
15
  constructor(props: IProperties) {
16 1
    super(props);
17
18
    this.state = {
19
      loadedLanguage: ''
20
    };
21
22
    Container.language.setupAdapter.addListener(this.onLanguageLoaded.bind(this));
23
  }
24
25
  componentDidMount(): void {
26
    Container.language.changeLanguageSetup.interact({languageCode: 'de-de'}, {}).then();
27
  }
28
29
  onLanguageLoaded(oldValue: ILanguageSetup, newValue: ILanguageSetup) {
30
    this.setState({loadedLanguage: newValue.languageCode})
31
  }
32
33
  render(): React.ReactNode {
34
    const model: ApplicationModel = Container.applicationPresenter.present('Application');
35
36
    return <ApplicationView model={model} />
37
  }
38
}